<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: LIKUS
  Date: 2019-12-11
  Time: 15:02:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>回复信息列表</title>
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
</head>
<body>
<center>
    <table border="1px" cellpadding="8px" cellspacing="0" style="text-align: center" width="60%">
        <tr>
            <td colspan="3"><h2>回复信息列表</h2></td>
        </tr>
        <tr>
            <td colspan="3">
                <a href="${pageContext.request.contextPath}/jsp/addreply.jsp?invid=${invid}">添加回复</a>
                <a href="${pageContext.request.contextPath}/main/list">返回帖子列表</a>
            </td>
        </tr>
        <tr>
            <th>回复内容</th>
            <th>回复昵称</th>
            <th>发布时间</th>
        </tr>
        <c:forEach items="${pageInfo.list}" var="reply">
            <tr>
                <td>${reply.content}</td>
                <td>${reply.author}</td>
                <td><fmt:formatDate value="${reply.createdate}" pattern="yyyy-MM-dd"></fmt:formatDate></td>
            </tr>
        </c:forEach>
    </table>
    <p>
        第${pageInfo.pageNum}/${pageInfo.pages}页
        <a href="javascript:toPage(1)">首页</a>
        <a href="javascript:toPage(${pageInfo.pageNum}-1)">上一页</a>
        <a href="javascript:toPage(${pageInfo.pageNum}+1)">下一页</a>
        <a href="javascript:toPage(${pageInfo.pages})">末页</a>
    </p>
</center>
</body>
<script>
    function toPage(pageNum) {
        window.location.href = "${pageContext.request.contextPath}/main/reply/${invid}/"+pageNum;
    }
</script>
<script>
    <c:if test="${msg01 eq 'success'}">
    alert("添加成功！");
    </c:if>
    <c:if   test="${msg01 eq 'fail'}">
    alert("添加失败！");
    </c:if>
</script>
</html>
